﻿@model Rated.Website.Models.RatedItemAttributeViewModel
<h2>@Model.AttributeType.Text</h2>
<div class="form">
    <form method="post" id="updateAttributes" action="@Url.Action("UpdateAttribute", "RatedItem")">
    @Html.HiddenFor(o => Model.Item.ID)
    @Html.HiddenFor(o=>o.AttributeType.ID)
    <ul class="attributeList clearfix">
        @{
            foreach (Rated.DAL.Db.Attribute att in Model.AttributeType.Attributes)
            {
                var current = Model.Item.RatedItem_Attribute.Where(o => o.AttributeID == att.ID).FirstOrDefault();
                
                <li class="clearfix">
                @{if (current == null)
                  { 
                    <input type="checkbox" name="Attribute" value="@att.ID" class="ratedItemAttribute" /><label>@att.Text</label>
                  }
                  else
                  { 
                    <input type="checkbox" name="Attribute" value="@att.ID" class="ratedItemAttribute" checked="checked" /><label>@att.Text</label>
                  }
                }
            </li>
            }   
        }
    </ul>
</div>
